// 点位管理 下接口
import request from '@/utils/request'

// 区域列表
export const AreaList = (params) => {
  return request({
    url: '/api/vm-service/region/search',
    params
  })
}
//
// 点位搜索
export const AreaDetails = ({ pageIndex = 1, pageSize = 10, regionId: regionId, name: name }) => {
  return request({
    url: `/api/vm-service/node/search`,
    params: {
      pageIndex, pageSize, regionId, name
    }
  })
}
// 新增区域
export const newlyAdded = (data) => {
  return request({
    url: '/api/vm-service/region',
    method: 'POST',
    data
  })
}

// 修改区域
export const ModifyArea = (data, region) => {
  return request({
    url: `/api/vm-service/region/${region}`,
    method: 'PUT',
    data
  })
}

// 删除区域
export const delArea = (id) => {
  return request({
    url: `/api/vm-service/region/${id}`,
    method: 'DELETE'
  })
}
// 商圈列表
export const BusinessCircle = () => {
  return request({
    url: '/api/vm-service/businessType'
  })
}

// 合作商搜索
export const Partners = (params) => {
  return request({
    url: '/api/user-service/partner/search',
    params
  })
}

// 新增合作商
export const addPartners = (data) => {
  return request({
    url: '/api/user-service/partner',
    method: 'POST',
    data
  })
}

// 新增点位
export const addPosition = (data) => {
  return request({
    url: '/api/vm-service/node',
    method: 'POST',
    data
  })
}

// 点位详情
export const getvmList = (id) => {
  return request({
    url: `/api/vm-service/node/vmList/${id}`
  })
}

// 修改点位
export const modifyPosition = (data, id) => {
  return request({
    url: `/api/vm-service/node/${id}`,
    method: 'PUT',
    data
  })
}

// 删除点位
export const delPosition = (id) => {
  return request({
    url: `/api/vm-service/node/${id}`,
    method: 'DELETE'
  })
}
// 修改区域
export const modifyRegion = (data) => {
  return request({
    url: `/api/vm-service/region/${data.id}`,
    method: 'PUT'
  })
}

// 重置合作商密码
export const resetPartners = (id) => {
  return request({
    url: `/api/user-service/partner/resetPwd/${id}`,
    method: 'PUT'
  })
}

// 修改合作商
export const modifyPartners = (data) => {
  return request({
    url: `/api/user-service/partner/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除合作商 /api/user-service/partner/:id
export const delPartners = (id) => {
  return request({
    url: `/api/user-service/partner/${id}`,
    method: 'DELETE'
  })
}
